include([ 'PClass' ],

function() {

	declare('exceptions.Assert');

	Assert = {};
	
	Assert.isFn = function(fn){
		return typeof fn == "function";
	};
	Assert.isSet = function(member){
		return member || member === 0 || member === '' || member === false;
	};
		
	/**
	 * require ( Map )
	 */
	Assert.require = function(map){
		for(var member in map){
			if( !Assert.isSet(map[member]) ) throw 'Required argument missing. ' + member;
		}
	};
	/**
	 * hasField (obj, List)
	 */
	Assert.hasField = function(obj, list, objName){
		objName = objName || obj.clz
		objName = objName || ''
		for(var i=0; i < list.length; i++){
			var member = obj[list[i]] 
			if( !Assert.isSet(member) )
				throw 'Missing Required Field (undefined). ' + objName + ' ' + member;
			else if( Assert.isFn(member) )
				throw 'Missing Required Field (field is a function). ' + objName + ' ' + member;
		}
	};
	/**
	 * hasFunction (obj, List, String)
	 */
	Assert.hasFunction = function(obj, list, objName){
		objName = objName || ''
		for(var i=0; i < list.length; i++){
			var member = obj[list[i]] 
			if( !Assert.isSet(member) )
				throw 'Missing Required Function (undefined). ' + objName + ' ' + member;
			else if( !Assert.isFn(member) )
				throw 'Missing Required Function (function is a field). ' + objName + ' ' + member;
		}
	};	
});